package com.cloudfun.campusshare.service;

import com.cloudfun.campusshare.common.exception.BusinessException;
import com.cloudfun.campusshare.common.model.vo.AppEditVO;
import com.cloudfun.campusshare.common.model.vo.AppVO;
import com.cloudfun.campusshare.common.response.BaseResult;
import com.cloudfun.campusshare.entity.AppEntity;
import org.springframework.data.domain.Pageable;

public interface AppService {

    /**
     * 新增应用
     *
     * @param appVo
     */
    BaseResult add(AppVO appVo) throws Exception;

    /**
     * 编辑应用
     *
     * @param appVo
     */
    BaseResult edit(AppEditVO appVo) throws BusinessException;

    /**
     * 查看应用信息
     *
     * @param appId
     */
    BaseResult getAppInfo(String appId) throws BusinessException;

    /**
     * 设备中心 - 首页设备列表
     *
     * @return
     */
    BaseResult queryAppList(Pageable pageable, String value) throws BusinessException;

    /**
     * 拿access_token
     *
     * @param appKey
     * @param appSecret
     * @return
     */
    BaseResult getAccessToken(String appKey, String appSecret);

    /**
     * 删除应用
     *
     * @param appId
     * @return
     */
    BaseResult<?> delete(String appId);

    /**
     * 保存应用草稿
     *
     * @param appVo
     * @return
     */
    BaseResult<?> saveAppDraft(AppVO appVo);

    /**
     * 应用转生产
     *
     * @param appId
     * @return
     */
    BaseResult<String> toProd(String appId);

    /**
     * 转生产成功动作
     *
     * @param appEntity
     */
    void onToProdSuccess(AppEntity appEntity);
}
